package com.aiwu

import android.graphics.Color
import android.util.Pair
import androidx.core.text.buildSpannedString
import androidx.core.text.inSpans
import com.aiwu.library.AiwuSimulator
import com.aiwu.library.App
import com.aiwu.library.abs.AbsCheatListener
import com.aiwu.library.bean.BurstOperateButtonBean
import com.aiwu.library.bean.CheatAddResult
import com.aiwu.library.bean.CheatGroupBean
import com.aiwu.library.bean.ClickOperateButtonBean
import com.aiwu.library.bean.KeyThemeGroupBean
import com.aiwu.library.bean.Menu
import com.aiwu.library.bean.OperateConfig
import com.aiwu.library.bean.RockerOperateButtonBean
import com.aiwu.library.bean.SystemInfoItem
import com.aiwu.library.bean.SystemInfoItemBean
import com.aiwu.library.bean.Triple
import com.aiwu.library.interfaces.ImageLoader
import com.aiwu.library.ui.widget.StrokeSpan
import com.aiwu.library.util.DisplayUtil
import com.aiwu.library.util.KeyThemeUtil
import com.aiwu.translate.interfaces.TranslateScreenshotListener
import com.aiwu.utils.CoilImageLoader
import com.aiwu.utils.GameIdUtil
import org.citra.citra_emu.BuildConfig
import org.citra.citra_emu.NativeLibrary
import org.citra.citra_emu.R
import org.citra.citra_emu.activities.EmulationActivity
import org.citra.citra_emu.ui.main.MainActivity
import java.util.regex.Pattern


open class MyApp : App<EmulationActivity>() {
    companion object {
        //用户输入金手指格式
        private const val REGEX_CHEAT_CODE = " *([A-Z0-9]{8}) +([A-Z0-9]{1,8}) *"

        //网络金手指格式
        private const val REGEX_NET_CHEAT_CODE = "([A-Z0-9]{8})-([A-Z0-9]{8})"

        lateinit var instance: MyApp
        fun cleanStr(src: String): String {
            return src.replace("\r", "").replace("\t", "")
        }

        /**
         * 是否从爱吾宝盒启动
         */
        @JvmStatic
        fun isLaunchFrom25Market(): Boolean {
            instance.allActivityList.forEach {
                if (it is MainActivity) {
                    return false
                }
            }
            return true
        }


        /**
         * 获取当前正在运行的游戏编号（16进制的字符串）
         */
        fun getRunningGameId(): String {
            val titleId = NativeLibrary.getRunningTitleId()
            return GameIdUtil.convertGameId(titleId)
        }
    }

    private val cheatPattern by lazy { Pattern.compile(REGEX_CHEAT_CODE) }
    private val netCheatPattern by lazy { Pattern.compile(REGEX_NET_CHEAT_CODE) }

    override fun onCreate() {
        super.onCreate()
        instance = this
        initSimulator()
    }

    override fun getImageLoader(): ImageLoader = CoilImageLoader()

    private fun initSimulator() {
        AiwuSimulator.setDebug(BuildConfig.DEBUG)
        //设置备案号
        AiwuSimulator.setBeiAnStr("浙ICP备12026372号-15A")
        AiwuSimulator.setSpeedMultipleArray(intArrayOf(1, 2, 4))
        AiwuSimulator.setSystemInfoItemList(SystemInfoItem.getLeastItemList().apply {
            add(Pair.create(SystemInfoItem.FPS.apply {
                minWidth = resources.getDimensionPixelOffset(R.dimen.qb_px_100)
            }, true))
        })
        AiwuSimulator.setSystemInfoCallback {
            if (it == SystemInfoItem.FPS) {
                //SYSTEM_FPS = 0,FPS = 1,FRAMETIME = 2,SPEED = 3
                val perfStats = NativeLibrary.getPerfStats()
                val fps = (perfStats[1] + 0.5).toInt()
                val speed = (perfStats[3] * 100.0 + 0.5).toInt()
                val value = buildSpannedString {
                    inSpans(StrokeSpan()) {
                        append("$fps ")
                    }
                    val color = resources.getColor(
                        if (speed >= 110) {
                            R.color.COLOR_F4AF3D
                        } else if (speed >= 90) {
                            R.color.color_white
                        } else {
                            R.color.white_50
                        }
                    )
                    inSpans(StrokeSpan(color)) {
                        append("${speed}%")
                    }
                }
                return@setSystemInfoCallback SystemInfoItemBean(
                    it.displayStr,
                    value
                )
            }
            return@setSystemInfoCallback null
        }
        val menuList = Menu.getAllMenuList().apply {
            remove(Menu.SWITCH_DISC)
            remove(Menu.BIOS)
        }
        AiwuSimulator.init(getBuildWithLandSet().apply {
            setPortSet(this)
            //按键皮肤
            val keyThemes = arrayListOf(
                KeyThemeGroupBean(
                    KeyThemeUtil.KEY_THEME_ID_INK_CLASSIC,
                    KeyThemeUtil.KEY_THEME_NAME_INK_CLASSIC,
                    Color.parseColor("#46048A"),
                    0.8f
                ),
                KeyThemeGroupBean(
                    KeyThemeUtil.KEY_THEME_ID_SILVER_LUSTER,
                    KeyThemeUtil.KEY_THEME_NAME_SILVER_LUSTER,
                    Color.parseColor("#9E9E9E"),
                    0.8f
                )
            )
            setKeyThemes(keyThemes)
        }.build(), menuList)
        //修补按键宽高比
        val idSizePairList = mutableListOf(
            Triple.create(
                InputManager.KEY_START,
                ClickOperateButtonBean.DEFAULT_SIZE_DP,
                ClickOperateButtonBean.DEFAULT_SIZE_DP
            ), Triple.create(
                InputManager.KEY_SELECT,
                ClickOperateButtonBean.DEFAULT_SIZE_DP,
                ClickOperateButtonBean.DEFAULT_SIZE_DP
            ), Triple.create(
                InputManager.KEY_L,
                ClickOperateButtonBean.DEFAULT_WIDTH_DP,
                ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            ), Triple.create(
                InputManager.KEY_R,
                ClickOperateButtonBean.DEFAULT_WIDTH_DP,
                ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            ), Triple.create(
                InputManager.KEY_ZL,
                ClickOperateButtonBean.DEFAULT_WIDTH_DP,
                ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            ), Triple.create(
                InputManager.KEY_ZR,
                ClickOperateButtonBean.DEFAULT_WIDTH_DP,
                ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            )
        )
        AiwuSimulator.patchWidthHeightOnScreenControlConfigs(idSizePairList)
        AiwuSimulator.setTranslateScreenshotCallback { _, screenshotListener: TranslateScreenshotListener ->
            emulationActivity?.getEmulationFragment()?.let {
                it.takeScreenshot { bitmap ->
                    screenshotListener.onGetScreenshotBitmap(bitmap, null)
                }
            } ?: let {
                screenshotListener.onGetScreenshotBitmap(null, null)
            }
        }
        AiwuSimulator.setCheatListener(object : AbsCheatListener() {
            override fun getCheatCodeHint(): String {
                return """
                    输入作弊码内容,格式：xxxxxxxx xxxxxxxx
                    多条换行显示例如：
                    1208B334 0000027C
                    2208B324 00000003
                    """.trimIndent()
            }

            override fun refreshCCheatList(willWrite2CheatFile: Boolean) {
                refreshCheatCode()
            }

            override fun addCheat(desc: String, code: String, user: Boolean): CheatAddResult {
                val lines = code.uppercase().trim().split("\n")
                val codeStr = buildString {
                    lines.forEach {
                        val line = cleanStr(it)
                        val m = cheatPattern.matcher(line)
                        val match = m.matches()
                        if (!match) {
                            return CheatAddResult(false)
                        }
                        if (isNotEmpty()) {
                            append(",")
                        }
                        val address = m.group(1) ?: ""
                        val value = (m.group(2) ?: "").padStart(8, '0')
                        append(address)
                            .append("-")
                            .append(value)
                    }
                }
                return CheatAddResult(true, desc, codeStr, null)
            }

            override fun enableEditCheatCode(): Boolean {
                return true
            }

            override fun restoreCheatCode(code: String): String {
                val lines = code.uppercase().trim().split(",")
                return buildString {
                    lines.forEach {
                        val m = netCheatPattern.matcher(it)
                        val match = m.matches()
                        if (!match) {
                            return code
                        }
                        if (isNotEmpty()) {
                            append("\n")
                        }
                        val address = m.group(1) ?: ""
                        val value = (m.group(2) ?: "")
                        append(address)
                            .append(" ")
                            .append(value)
                    }
                }
            }

            override fun editCheat(
                desc: String,
                code: String,
                groupPosition: Int,
                cheatGroupBean: CheatGroupBean
            ): CheatAddResult {
                //跟添加处理方法一样
                return addCheat(desc, code, true)
            }

            override fun enableMultipleAddCheatCode(): Boolean = true

            override fun getMultipleAddCheatHint(): String {
                return """
                    输入作弊码内容,格式：
                    普通金手指：
                    #金手指描述
                    xxxxxxxx xxxxxxxx
                    xxxxxxxx xxxxxxxx
                    分组金手指："D"(单选)或者"F"(多选)分组开始，"E"分组结束
                    D#组描述
                    #子描述
                    xxxxxxxx xxxxxxxx
                    #子描述
                    xxxxxxxx xxxxxxxx
                    E
                    例如：
                    #无敌
                    1208B334 0000027C
                    D#选关
                    #第一关
                    12345678 00000001
                    #第二关
                    12345678 00000002
                    E
                    """.trimIndent()
            }

            override fun getMultipleAddCheatCodeRegex(): Array<String> {
                return arrayOf(REGEX_CHEAT_CODE)
            }
        })
    }

    /**
     * 刷新金手指
     */
    fun refreshCheatCode() {
        AiwuSimulator.getCheatDataBean()?.let {
            val codes = mutableListOf<String>()
            for (groupBean in it.cheatList) {
                if (groupBean.haveChildren()) {
                    for (childBean in groupBean.children) {
                        if (!childBean.isEnable) {
                            continue
                        }
                        var isOk = true
                        for (item in childBean.cheatCode.split(",")) {
                            if (item.isEmpty() || !netCheatPattern.matcher(item).matches()) {
                                isOk = false
                                break
                            }
                        }
                        if (isOk) {
                            codes.add(childBean.cheatCode.replace(",", "\n").replace("-", " "))
                        }
                    }
                } else {
                    if (!groupBean.isEnable) {
                        continue
                    }
                    var isOk = true
                    for (item in groupBean.cheatCode.split(",")) {
                        if (item.isEmpty() || !netCheatPattern.matcher(item).matches()) {
                            isOk = false
                            break
                        }
                    }
                    if (isOk) {
                        codes.add(groupBean.cheatCode.replace(",", "\n").replace("-", " "))
                    }
                }
            }
            if (codes.isEmpty()) {
                NativeLibrary.updateCheat25(null)
            } else {
                NativeLibrary.updateCheat25(codes.toTypedArray())
            }
        }
    }

    /**
     * 横屏的默认按钮
     */
    private fun getBuildWithLandSet(): OperateConfig.Builder {
        //设计宽度
        val designWidth = DisplayUtil.getAppLandscapeScreenWidth()
        //设计高度
        val designHeight = DisplayUtil.getAppLandscapeScreenHeight()
        //间隔
        val spacing = DisplayUtil.dp2px(8f)
        //圆形按钮宽高
        val roundBtnSize = DisplayUtil.dp2px(BurstOperateButtonBean.DEFAULT_SIZE_DP.toFloat())
        //方形按钮宽
        val recBtnWidth = DisplayUtil.dp2px(ClickOperateButtonBean.DEFAULT_WIDTH_DP.toFloat())
        //方形按钮高
        val recBtnHeight = DisplayUtil.dp2px(ClickOperateButtonBean.DEFAULT_HEIGHT_DP.toFloat())

        val homeBtnSizeDp = 25
        val homeBtnSize = DisplayUtil.dp2px(homeBtnSizeDp.toFloat())

        //主摇杆大小
        val mainRockerSizeDp = RockerOperateButtonBean.DEFAULT_SIZE_DP
        val mainRockerSize = DisplayUtil.dp2px(mainRockerSizeDp.toFloat())
        //十字键大小
        val crossRockerSizeDp = (RockerOperateButtonBean.DEFAULT_SIZE_DP * 0.8f).toInt()
        val crossRockerSize = DisplayUtil.dp2px(crossRockerSizeDp.toFloat())
        //C摇杆大小
        val cRockerSizeDp = (RockerOperateButtonBean.DEFAULT_SIZE_DP * 0.6f).toInt()
        val cRockerSize = DisplayUtil.dp2px(cRockerSizeDp.toFloat())
        val mainRockerY = designHeight - mainRockerSize - spacing * 2
        val crossRockerY = mainRockerY - crossRockerSize + spacing * 3
        val rButtonX = designWidth - recBtnWidth - spacing
        val zlButtonY = crossRockerY - spacing * 2 - recBtnHeight
        val rButtonY = zlButtonY - spacing - recBtnHeight
        val selectButtonX = (designWidth / 2 - roundBtnSize * 1.3f).toInt()
        val startButtonX = selectButtonX + roundBtnSize + spacing * 2
        val selectButtonY = designHeight - roundBtnSize - spacing * 4
        val homeButtonX =
            selectButtonX + (startButtonX + roundBtnSize - selectButtonX - homeBtnSize) / 2
        val homeButtonY = selectButtonY - homeBtnSize - spacing
        val aButtonX = designWidth - roundBtnSize - spacing * 2
        val bButtonX = (aButtonX - roundBtnSize * 0.9).toInt()
        val yButtonX = (bButtonX - roundBtnSize * 0.9).toInt()
        val bButtonY = designHeight - roundBtnSize - spacing * 3
        val aButtonY = (bButtonY - roundBtnSize * 0.9).toInt()
        val xButtonY = (aButtonY - roundBtnSize * 0.9).toInt()
        val cRockerX = yButtonX - spacing - cRockerSize
        val cRockerY = designHeight - cRockerSize - spacing * 3
        val set = LinkedHashSet<ClickOperateButtonBean>()
        val l = BurstOperateButtonBean(
            InputManager.KEY_L,
            spacing,
            rButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
        }
        set.add(l)
        val r = BurstOperateButtonBean(
            InputManager.KEY_R,
            rButtonX,
            rButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
        }
        set.add(r)
        val zl = BurstOperateButtonBean(
            InputManager.KEY_ZL,
            spacing,
            zlButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            isShow = false
        }
        set.add(zl)
        val zr = BurstOperateButtonBean(
            InputManager.KEY_ZR,
            rButtonX,
            zlButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            isShow = false
        }
        set.add(zr)
        val select = ClickOperateButtonBean(
            InputManager.KEY_SELECT,
            selectButtonX,
            selectButtonY,
        )
        set.add(select)
        val start = ClickOperateButtonBean(
            InputManager.KEY_START,
            startButtonX,
            selectButtonY,
        )
        set.add(start)
        val home = ClickOperateButtonBean(
            InputManager.KEY_HOME,
            homeButtonX,
            homeButtonY,
        ).apply {
            defaultWidthDp = homeBtnSizeDp
            defaultHeightDp = homeBtnSizeDp
            isShow = false
        }
        set.add(home)
        val a = BurstOperateButtonBean(
            InputManager.KEY_A,
            aButtonX,
            aButtonY,
            false
        )
        set.add(a)
        val b = BurstOperateButtonBean(
            InputManager.KEY_B,
            bButtonX,
            bButtonY,
            false
        )
        set.add(b)
        val x = BurstOperateButtonBean(
            InputManager.KEY_X,
            bButtonX,
            xButtonY,
            false
        )
        set.add(x)
        val y = BurstOperateButtonBean(
            InputManager.KEY_Y,
            yButtonX,
            aButtonY,
            false
        )
        set.add(y)
        val landscapeRockers = LinkedHashSet<RockerOperateButtonBean>()
        val crossRocker = RockerOperateButtonBean(
            InputManager.KEY_ROCKER_CROSS,
            spacing,
            crossRockerY,
            crossRockerSizeDp,
            crossRockerSizeDp,
            RockerOperateButtonBean.CROSS
        )
        landscapeRockers.add(crossRocker)
        val mainRocker = RockerOperateButtonBean(
            InputManager.KEY_ROCKER_MAIN,
            crossRockerSize,
            mainRockerY,
            mainRockerSizeDp,
            mainRockerSizeDp,
            RockerOperateButtonBean.CLASSIC
        )
        landscapeRockers.add(mainRocker)
        val cRocker = RockerOperateButtonBean(
            InputManager.KEY_ROCKER_C,
            cRockerX,
            cRockerY,
            cRockerSizeDp,
            cRockerSizeDp,
            RockerOperateButtonBean.CLASSIC,
            0.6f
        ).apply {
            isShow = false
        }
        landscapeRockers.add(cRocker)
        return OperateConfig.Builder(set, RockerOperateButtonBean.NULL)
            .setLandscapeRockers(landscapeRockers)
            .setGamePadMap(
                InputManager.getKeyBitmapNameMap(),
                InputManager.getGameKeys(),
                true,
                InputManager.getDefaultHandleMap()
            )
            .setSupportPlayerNum(1)
    }


    /**
     * 竖屏的默认按钮
     */
    private fun setPortSet(builder: OperateConfig.Builder) {
        //设计宽度
        val designWidth = DisplayUtil.getAppLandscapeScreenHeight()
        //设计高度
        val designHeight = DisplayUtil.getAppLandscapeScreenWidth()
        //间隔
        val spacing = DisplayUtil.dp2px(6f)
        //圆形按钮宽高
        val roundBtnSize = DisplayUtil.dp2px(BurstOperateButtonBean.DEFAULT_SIZE_DP.toFloat())
        //方形按钮宽
        val recBtnWidth = DisplayUtil.dp2px(ClickOperateButtonBean.DEFAULT_WIDTH_DP.toFloat())
        //方形按钮高
        val recBtnHeight = DisplayUtil.dp2px(ClickOperateButtonBean.DEFAULT_HEIGHT_DP.toFloat())

        val homeBtnSizeDp = 25
        val homeBtnSize = DisplayUtil.dp2px(homeBtnSizeDp.toFloat())

        //主摇杆大小
        val mainRockerSizeDp = RockerOperateButtonBean.DEFAULT_SIZE_DP
        val mainRockerSize = DisplayUtil.dp2px(mainRockerSizeDp.toFloat())
        //十字键大小
        val crossRockerSizeDp = (RockerOperateButtonBean.DEFAULT_SIZE_DP * 0.8f).toInt()
        val crossRockerSize = DisplayUtil.dp2px(crossRockerSizeDp.toFloat())
        //C摇杆大小
        val cRockerSizeDp = (RockerOperateButtonBean.DEFAULT_SIZE_DP * 0.6f).toInt()
        val cRockerSize = DisplayUtil.dp2px(cRockerSizeDp.toFloat())
        val mainRockerX = spacing * 3
        val mainRockerY = designHeight - mainRockerSize - spacing * 3
        val crossRockerY = mainRockerY - crossRockerSize - spacing * 4
        val cRockerX = designWidth - cRockerSize - spacing
        val rButtonX = designWidth - recBtnWidth - spacing
        val zlButtonY = crossRockerY - spacing * 2 - recBtnHeight
        val rButtonY = zlButtonY - spacing - recBtnHeight
        val selectButtonX = designWidth / 2 - roundBtnSize
        val startButtonX = selectButtonX + roundBtnSize + spacing * 2
        val homeButtonX =
            selectButtonX + (startButtonX + roundBtnSize - selectButtonX - homeBtnSize) / 2
        val aButtonX = designWidth - roundBtnSize - spacing * 2
        val bButtonX = (aButtonX - roundBtnSize * 0.9).toInt()
        val yButtonX = (bButtonX - roundBtnSize * 0.9).toInt()
        val bButtonY = designHeight - roundBtnSize - spacing * 3
        val aButtonY = (bButtonY - roundBtnSize * 0.9).toInt()
        val xButtonY = (aButtonY - roundBtnSize * 0.9).toInt()
        val homeButtonY = xButtonY - homeBtnSize - spacing * 3
        val selectButtonY = homeButtonY - roundBtnSize - spacing * 2
        val set = java.util.LinkedHashSet<ClickOperateButtonBean>()
        val l = BurstOperateButtonBean(
            InputManager.KEY_L,
            spacing,
            rButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
        }
        set.add(l)
        val r = BurstOperateButtonBean(
            InputManager.KEY_R,
            rButtonX,
            rButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
        }
        set.add(r)
        val zl = BurstOperateButtonBean(
            InputManager.KEY_ZL,
            spacing,
            zlButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            isShow = false
        }
        set.add(zl)
        val zr = BurstOperateButtonBean(
            InputManager.KEY_ZR,
            rButtonX,
            zlButtonY,
            false
        ).apply {
            defaultWidthDp = ClickOperateButtonBean.DEFAULT_WIDTH_DP
            defaultHeightDp = ClickOperateButtonBean.DEFAULT_HEIGHT_DP
            isShow = false
        }
        set.add(zr)
        val select = ClickOperateButtonBean(
            InputManager.KEY_SELECT,
            selectButtonX,
            selectButtonY,
        )
        set.add(select)
        val start = ClickOperateButtonBean(
            InputManager.KEY_START,
            startButtonX,
            selectButtonY,
        )
        set.add(start)
        val home = ClickOperateButtonBean(
            InputManager.KEY_HOME,
            homeButtonX,
            homeButtonY,
        ).apply {
            defaultWidthDp = homeBtnSizeDp
            defaultHeightDp = homeBtnSizeDp
            isShow = false
        }
        set.add(home)
        val a = BurstOperateButtonBean(
            InputManager.KEY_A,
            aButtonX,
            aButtonY,
            false
        )
        set.add(a)
        val b = BurstOperateButtonBean(
            InputManager.KEY_B,
            bButtonX,
            bButtonY,
            false
        )
        set.add(b)
        val x = BurstOperateButtonBean(
            InputManager.KEY_X,
            bButtonX,
            xButtonY,
            false
        )
        set.add(x)
        val y = BurstOperateButtonBean(
            InputManager.KEY_Y,
            yButtonX,
            aButtonY,
            false
        )
        set.add(y)
        val portraitRockers = java.util.LinkedHashSet<RockerOperateButtonBean>()
        val crossRocker = RockerOperateButtonBean(
            InputManager.KEY_ROCKER_CROSS,
            spacing,
            crossRockerY,
            crossRockerSizeDp,
            crossRockerSizeDp,
            RockerOperateButtonBean.CROSS
        )
        portraitRockers.add(crossRocker)
        val mainRocker = RockerOperateButtonBean(
            InputManager.KEY_ROCKER_MAIN,
            mainRockerX,
            mainRockerY,
            mainRockerSizeDp,
            mainRockerSizeDp,
            RockerOperateButtonBean.CLASSIC
        )
        portraitRockers.add(mainRocker)
        val cRocker = RockerOperateButtonBean(
            InputManager.KEY_ROCKER_C,
            cRockerX,
            crossRockerY,
            cRockerSizeDp,
            cRockerSizeDp,
            RockerOperateButtonBean.CLASSIC,
            0.6f
        ).apply {
            isShow = false
        }
        portraitRockers.add(cRocker)
        builder.setPortraitButtons(set)
            .setPortraitRockers(portraitRockers)
    }
}